﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using ConvergensDominoConnector;

namespace CDCOSDH
{
    public partial class FindCaseNum : Form
    {
        private string sdhName;

        public List<string> selectedRow = new List<string>(10);

        public FindCaseNum(string sdhName)
        {
            
            InitializeComponent();
            this.sdhName = sdhName;
            this.rb1.Select();
        }

        private void btnOk_Click(object sender, EventArgs e)
        {

             if(rb1.Checked)
             {
                 using (MyActiveCases myActCases = new MyActiveCases(this.sdhName, "pick.sag.mine"))
                 {
                     if (myActCases.ShowDialog(this) == DialogResult.OK)
                     {
                         this.selectedRow.AddRange(myActCases.selectedRow);
                         this.DialogResult = DialogResult.OK;
                     }
                 }
             }

             if (rb2.Checked)
             {
                 using (ActiveCasesByOffice actCasesByOffice = new ActiveCasesByOffice(this.sdhName, "pick.sag.kontor"))
                 {
                     if (actCasesByOffice.ShowDialog(this) == DialogResult.OK)
                     {
                         this.selectedRow.AddRange(actCasesByOffice.selectedRow);
                         this.DialogResult = DialogResult.OK;
                     }
                 }

             }

             if (rb3.Checked)
             {
                 using (ActiveCasesByCaseOfficer actCasesByCaseOfficer = new ActiveCasesByCaseOfficer(this.sdhName, "pick.sag.mine"))
                 {
                     if (actCasesByCaseOfficer.ShowDialog(this) == DialogResult.OK)
                     {
                         this.selectedRow.AddRange(actCasesByCaseOfficer.selectedRow);
                         this.DialogResult = DialogResult.OK;
                     }
                 }
             }

             if (rb4.Checked)
             {
                 using (AllActiveCases allActiveCases = new AllActiveCases(this.sdhName, "pick.sag.alle"))
                 {
                     if (allActiveCases.ShowDialog(this) == DialogResult.OK)
                     {
                         this.selectedRow.AddRange(allActiveCases.selectedRow);
                         this.DialogResult = DialogResult.OK;
                     }
                 }
             }

        }

        private void btnCnl_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.Cancel;
        }
    }
}
